package com.example.demo.controller;

import com.example.demo.controller.annotationspring.MyPermission;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author : spiderman
 * @version : 1.0
 * @FileName : com.annotation.demo
 * @Description :
 * @Create Date : 2022/1/5 00:24
 **/
@RestController
public class TestController {

    /**
     * 权限为admin才能访问
     * @return
     */
    @RequestMapping("/api/test")
    @MyPermission(value = "admin")
    public String test() {
        return "hello world";
    }

    /**
     * 权限为test2才能访问
     * @return
     */
    @RequestMapping("/api/test2")
    @MyPermission(value = "test2")
    public String test2() {
        return "hello world";
    }

}

